home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 6 / MacMania 6.toast / / Tools&Utilities / EnterAct Stuff / Drag_on Modules / hAWK example progs / $hum_to_text < prev    next >
Text File  |  1994-01-26  |  606b  |  52 lines

  1. # $hum_to_text: strip CR's from within paragraphs, paragraph
  2. # starts as in the hAWK User's Manual (hum)
  3.  
  4. BEGIN {
  5.     
  6.     while (getline x > 0)
  7.         {
  8.         if (para_start())
  9.             {
  10.             paragraph()
  11.             buffer = x
  12.             }
  13.         else if (para_end())
  14.             {
  15.             buffer = buffer x
  16.             paragraph()
  17.             }
  18.         else
  19.             buffer = buffer x
  20.         }
  21.     paragraph()
  22.     }
  23.  
  24. function paragraph()
  25.     {
  26.     print buffer
  27.     buffer = ""
  28.     }
  29.  
  30. function para_start()
  31.     {
  32.     if (x == "")
  33.         return 1;
  34.     if (x ~ /^[0-9]/)
  35.         return 1;
  36.     if (x ~ /^•/)
  37.         return 1;
  38.     if (x ~ /^ /) # option space
  39.         return 1;
  40.     if (x ~ /^----*/)
  41.         {
  42.         x = ""
  43.         return 1
  44.         }
  45.     }
  46.  
  47. function para_end()
  48.     {
  49.     
  50.     }
  51.  
  52.